package cn.wolfcode.wolf2w.controller;

import cn.wolfcode.wolf2w.domain.Destination;
import cn.wolfcode.wolf2w.domain.Region;
import cn.wolfcode.wolf2w.query.DestinationQuery;
import cn.wolfcode.wolf2w.query.QueryObject;
import cn.wolfcode.wolf2w.service.IDestinationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("destination")
public class DestinationController {
    @Autowired
    private IDestinationService destinationService;

    @RequestMapping("list")
    public String list(Model model, @ModelAttribute("qo") DestinationQuery qo){
        Page<Destination> page = destinationService.queryPageList(qo);
        model.addAttribute("page",page);
        List<Destination> toasts = destinationService.getToast(qo);
        model.addAttribute("toasts",toasts);
        return "destination/list";
    }
}
